#include <iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
#include<unordered_set>
using namespace std;


#include <stdio.h>
bool isZ(int const& re)
{
	if (re ==0) { return 0; }
	if (re <= 3) { return 1; }
	for (int i = 2; i < re; i++)
	{
		if (re % i == 0) { return 0; }
	}
	return 1;
}
int main()

{
	string s;
	int n;
	cin >> s>>n;
	int shengyu = n%s.size() ;

	//cout << (int)'a';
	//-97
	int* app = new int[26];
	for (int i = 0; i < 26; i++)
	{
		app[i]=0;
	}
	if (n <= s.size()) {
		for (int i = 0; i < n; i++)
		{
			app[((int)s[i]) - 97]++;
			//cout << app[((int)s[i]) - 97] << endl;
		}
	}
	else
	{
		for (int i = 0; i < s.size(); i++)
		{
			app[((int)s[i]) - 97]++;
			//cout << app[((int)s[i]) - 97] << endl;
		}
		for (int i = 0; i < shengyu; i++)
		{
			app[((int)s[i]) - 97]++;
			//cout << s[i] << endl;
		}
	}


	//for (int i = 0; i < 26; i++)
	//{
	//	cout<<app[i]<<" " ;
	//}
	int Max=*max_element(app, app + 26);
	int Min=Max;
	for (int i = 0; i < 26; i++)
	{
		if (app[i] != 0 && app[i] < Min)
		{
			Min = app[i];
		};
	}
	int re= Max - Min;
	if (isZ(re)) { cout << "Yes"<<endl; }
	else{ cout << "No" << endl; }
	cout << re;
}